<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

    <style>
        .d1 {
            width: 400px;
            height: 200px;
            border:  1px solid red;
        }

        .d2 {
            width: 100px;
            height: 50px;
            font-size: 20px;
            line-height: 50px;
            margin: 75px auto;
            border: 1px solid yellow;
            text-align: center;
        }

        .d3 {
            margin-top: 10px;
            width: 400px;
            height: 200px;
            border:  1px solid red;
            position: relative;
            text-align: center;
        }

        .d4 {
            width: 100px;
            height: 50px;
            font-size: 20px;
            line-height: 50px;
            position: absolute;
            top: 50%;
            left: 50%;
            margin-top: -25px;
            margin-left: -50px;
            border: 1px solid yellow;
            text-align: center;
        }


        .d5   {
            width: 400px;
            height: 400px;
            border:  1px solid red;
        }
        
        .d6 {
            width: 50px;
            height: 50px;
            background: pink;
            animation: move linear 5s infinite;
        }
        
        @keyframes move {
            0% {
                transform: translateY(0px);
            }

            25% {
                transform: translateX(350px);
            }

            50% {
                transform: translate(350px,350px);

            }

            75% {
                transform: translateY(350px);
            }

            100% {
                transform: translate(0px) ;
            }
        }
    </style>
</head>
<body>


<div class="d1">
    <div class="d2">居中</div>
</div>

<div class="d3">
    <div class="d4">居中</div>
</div>


<div class="d5">
    <div class="d6"></div>
</div>
</body>
</html>